package cn.com.mayue.guava.basic;

import com.google.common.collect.ComparisonChain;
import org.junit.Test;

/**
 * Created by mayue on 2016/12/4.
 * 简化比较
 * 多个字段的比较
 */
public class ComparisonChainTest {
    @Test
    public void testComparisonChain() {
        System.out.println(ComparisonChain.start().compare(1, 1)
                .compare(2, 2).compare(3L,4L).result());

        System.out.println(ComparisonChain.start().compare(1, 1)
                .compare(1, 2).compare(4L,4L).result());

        System.out.println(ComparisonChain.start().compare(1, 1)
                .compare(2, 2).compare(4L,4L).result());


    }
}
